<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.5"/>
<title>eccodes: The message handle</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">eccodes
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.5 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="modules.html"><span>C&#160;Interface</span></a></li>
      <li><a href="classeccodes.html"><span>F90&#160;Interface</span></a></li>
      <li><a href="namespaces.html"><span>Python&#160;Interface</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
</div><!-- top -->
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Data Structures</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Groups</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Pages</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#nested-classes">Data Structures</a> &#124;
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">The message handle</div>  </div>
</div><!--header-->
<div class="contents">
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a>
Data Structures</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structcodes__handle.html">codes_handle</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structcodes__multi__handle.html">codes_multi_handle</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ga4c2203d55c2c3ca792e44e4eb26edfb5"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__codes__handle.html#ga4c2203d55c2c3ca792e44e4eb26edfb5">codes_count_in_file</a> (<a class="el" href="structcodes__context.html">codes_context</a> *c, FILE *f, int *n)</td></tr>
<tr class="memdesc:ga4c2203d55c2c3ca792e44e4eb26edfb5"><td class="mdescLeft">&#160;</td><td class="mdescRight">Counts the messages contained in a file resource.  <a href="#ga4c2203d55c2c3ca792e44e4eb26edfb5">More...</a><br/></td></tr>
<tr class="separator:ga4c2203d55c2c3ca792e44e4eb26edfb5"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga6ec42bd6272b4a0f2cb2b220b86c71c8"><td class="memItemLeft" align="right" valign="top">grib_handle *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__codes__handle.html#ga6ec42bd6272b4a0f2cb2b220b86c71c8">codes_handle_new_from_file</a> (grib_context *c, FILE *f, ProductKind product, int *error)</td></tr>
<tr class="memdesc:ga6ec42bd6272b4a0f2cb2b220b86c71c8"><td class="mdescLeft">&#160;</td><td class="mdescRight">Create a handle from a file resource.  <a href="#ga6ec42bd6272b4a0f2cb2b220b86c71c8">More...</a><br/></td></tr>
<tr class="separator:ga6ec42bd6272b4a0f2cb2b220b86c71c8"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga36de77229cc3b386d26c1e7b52c21e0e"><td class="memItemLeft" align="right" valign="top">grib_handle *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__codes__handle.html#ga36de77229cc3b386d26c1e7b52c21e0e">codes_grib_handle_new_from_file</a> (grib_context *c, FILE *f, int *error)</td></tr>
<tr class="memdesc:ga36de77229cc3b386d26c1e7b52c21e0e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Create a GRIB handle from a file resource.  <a href="#ga36de77229cc3b386d26c1e7b52c21e0e">More...</a><br/></td></tr>
<tr class="separator:ga36de77229cc3b386d26c1e7b52c21e0e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga6958c3cd7e4059af5c26898a872262ff"><td class="memItemLeft" align="right" valign="top">grib_handle *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__codes__handle.html#ga6958c3cd7e4059af5c26898a872262ff">codes_bufr_handle_new_from_file</a> (grib_context *c, FILE *f, int *error)</td></tr>
<tr class="memdesc:ga6958c3cd7e4059af5c26898a872262ff"><td class="mdescLeft">&#160;</td><td class="mdescRight">Create a BUFR handle from a file resource.  <a href="#ga6958c3cd7e4059af5c26898a872262ff">More...</a><br/></td></tr>
<tr class="separator:ga6958c3cd7e4059af5c26898a872262ff"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gac82dbaba240ebf6e76cdbcf2007a6bee"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__codes__handle.html#gac82dbaba240ebf6e76cdbcf2007a6bee">codes_write_message</a> (<a class="el" href="structcodes__handle.html">codes_handle</a> *h, const char *file, const char *mode)</td></tr>
<tr class="memdesc:gac82dbaba240ebf6e76cdbcf2007a6bee"><td class="mdescLeft">&#160;</td><td class="mdescRight">Write a coded message to a file.  <a href="#gac82dbaba240ebf6e76cdbcf2007a6bee">More...</a><br/></td></tr>
<tr class="separator:gac82dbaba240ebf6e76cdbcf2007a6bee"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga095447ed85ff2142dbda2867ee3b4c8d"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structcodes__handle.html">codes_handle</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__codes__handle.html#ga095447ed85ff2142dbda2867ee3b4c8d">codes_handle_new_from_message</a> (<a class="el" href="structcodes__context.html">codes_context</a> *c, const void *data, size_t data_len)</td></tr>
<tr class="memdesc:ga095447ed85ff2142dbda2867ee3b4c8d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Create a handle from a user message in memory.  <a href="#ga095447ed85ff2142dbda2867ee3b4c8d">More...</a><br/></td></tr>
<tr class="separator:ga095447ed85ff2142dbda2867ee3b4c8d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga385864d5f06e1de0e8ee13388ca4117c"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structcodes__handle.html">codes_handle</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__codes__handle.html#ga385864d5f06e1de0e8ee13388ca4117c">codes_grib_handle_new_from_multi_message</a> (<a class="el" href="structcodes__context.html">codes_context</a> *c, void **data, size_t *data_len, int *error)</td></tr>
<tr class="memdesc:ga385864d5f06e1de0e8ee13388ca4117c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Create a handle from a user message in memory.  <a href="#ga385864d5f06e1de0e8ee13388ca4117c">More...</a><br/></td></tr>
<tr class="separator:ga385864d5f06e1de0e8ee13388ca4117c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga079df0c709e381812ae13af08c354032"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structcodes__handle.html">codes_handle</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__codes__handle.html#ga079df0c709e381812ae13af08c354032">codes_handle_new_from_message_copy</a> (<a class="el" href="structcodes__context.html">codes_context</a> *c, const void *data, size_t data_len)</td></tr>
<tr class="memdesc:ga079df0c709e381812ae13af08c354032"><td class="mdescLeft">&#160;</td><td class="mdescRight">Create a handle from a user message.  <a href="#ga079df0c709e381812ae13af08c354032">More...</a><br/></td></tr>
<tr class="separator:ga079df0c709e381812ae13af08c354032"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga3b281a237e311c6b8fa4bd7096d7e025"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structcodes__handle.html">codes_handle</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__codes__handle.html#ga3b281a237e311c6b8fa4bd7096d7e025">codes_grib_handle_new_from_samples</a> (<a class="el" href="structcodes__context.html">codes_context</a> *c, const char *sample_name)</td></tr>
<tr class="memdesc:ga3b281a237e311c6b8fa4bd7096d7e025"><td class="mdescLeft">&#160;</td><td class="mdescRight">Create a handle from a GRIB message contained in a samples directory.  <a href="#ga3b281a237e311c6b8fa4bd7096d7e025">More...</a><br/></td></tr>
<tr class="separator:ga3b281a237e311c6b8fa4bd7096d7e025"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga56d0f831e520ec7bc4a0ca334c63f557"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structcodes__handle.html">codes_handle</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__codes__handle.html#ga56d0f831e520ec7bc4a0ca334c63f557">codes_bufr_handle_new_from_samples</a> (<a class="el" href="structcodes__context.html">codes_context</a> *c, const char *sample_name)</td></tr>
<tr class="memdesc:ga56d0f831e520ec7bc4a0ca334c63f557"><td class="mdescLeft">&#160;</td><td class="mdescRight">Create a handle from a BUFR message contained in a samples directory.  <a href="#ga56d0f831e520ec7bc4a0ca334c63f557">More...</a><br/></td></tr>
<tr class="separator:ga56d0f831e520ec7bc4a0ca334c63f557"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga7b226527aa98d90f2bdb470105732878"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structcodes__handle.html">codes_handle</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__codes__handle.html#ga7b226527aa98d90f2bdb470105732878">codes_handle_clone</a> (<a class="el" href="structcodes__handle.html">codes_handle</a> *h)</td></tr>
<tr class="memdesc:ga7b226527aa98d90f2bdb470105732878"><td class="mdescLeft">&#160;</td><td class="mdescRight">Clone an existing handle using the context of the original handle, The message is copied and reparsed.  <a href="#ga7b226527aa98d90f2bdb470105732878">More...</a><br/></td></tr>
<tr class="separator:ga7b226527aa98d90f2bdb470105732878"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga358ea000ceed775e7367ccab581be978"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__codes__handle.html#ga358ea000ceed775e7367ccab581be978">codes_handle_delete</a> (<a class="el" href="structcodes__handle.html">codes_handle</a> *h)</td></tr>
<tr class="memdesc:ga358ea000ceed775e7367ccab581be978"><td class="mdescLeft">&#160;</td><td class="mdescRight">Frees a handle, also frees the message if it is not a user message.  <a href="#ga358ea000ceed775e7367ccab581be978">More...</a><br/></td></tr>
<tr class="separator:ga358ea000ceed775e7367ccab581be978"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga5ff59672d9eab49c0285c8f60e379d88"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structcodes__multi__handle.html">codes_multi_handle</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__codes__handle.html#ga5ff59672d9eab49c0285c8f60e379d88">codes_grib_multi_handle_new</a> (<a class="el" href="structcodes__context.html">codes_context</a> *c)</td></tr>
<tr class="memdesc:ga5ff59672d9eab49c0285c8f60e379d88"><td class="mdescLeft">&#160;</td><td class="mdescRight">Create an empty multi-field GRIB handle.  <a href="#ga5ff59672d9eab49c0285c8f60e379d88">More...</a><br/></td></tr>
<tr class="separator:ga5ff59672d9eab49c0285c8f60e379d88"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga068715aab8b82a5d3092064b6bc27f3d"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__codes__handle.html#ga068715aab8b82a5d3092064b6bc27f3d">codes_grib_multi_handle_append</a> (<a class="el" href="structcodes__handle.html">codes_handle</a> *h, int start_section, <a class="el" href="structcodes__multi__handle.html">codes_multi_handle</a> *mh)</td></tr>
<tr class="memdesc:ga068715aab8b82a5d3092064b6bc27f3d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Append the sections starting with start_section of the message pointed by h at the end of the multi-field GRIB handle mh.  <a href="#ga068715aab8b82a5d3092064b6bc27f3d">More...</a><br/></td></tr>
<tr class="separator:ga068715aab8b82a5d3092064b6bc27f3d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga85a955bdd3012ce499e50768e298b849"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__codes__handle.html#ga85a955bdd3012ce499e50768e298b849">codes_grib_multi_handle_delete</a> (<a class="el" href="structcodes__multi__handle.html">codes_multi_handle</a> *mh)</td></tr>
<tr class="memdesc:ga85a955bdd3012ce499e50768e298b849"><td class="mdescLeft">&#160;</td><td class="mdescRight">Delete multi-field GRIB handle.  <a href="#ga85a955bdd3012ce499e50768e298b849">More...</a><br/></td></tr>
<tr class="separator:ga85a955bdd3012ce499e50768e298b849"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gac06089d897eea71d8944cc622a45737f"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__codes__handle.html#gac06089d897eea71d8944cc622a45737f">codes_grib_multi_handle_write</a> (<a class="el" href="structcodes__multi__handle.html">codes_multi_handle</a> *mh, FILE *f)</td></tr>
<tr class="memdesc:gac06089d897eea71d8944cc622a45737f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Write a multi-field GRIB handle in a file.  <a href="#gac06089d897eea71d8944cc622a45737f">More...</a><br/></td></tr>
<tr class="separator:gac06089d897eea71d8944cc622a45737f"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<p>The <a class="el" href="structcodes__handle.html">codes_handle</a> is the structure giving access to parsed message values by keys. </p>
<h2 class="groupheader">Function Documentation</h2>
<a class="anchor" id="ga6958c3cd7e4059af5c26898a872262ff"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">grib_handle* codes_bufr_handle_new_from_file </td>
          <td>(</td>
          <td class="paramtype">grib_context *&#160;</td>
          <td class="paramname"><em>c</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">FILE *&#160;</td>
          <td class="paramname"><em>f</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int *&#160;</td>
          <td class="paramname"><em>error</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Create a BUFR handle from a file resource. </p>
<p>The file is read until a BUFR message is found. The message is then copied. Remember always to delete the handle when it is not needed anymore to avoid memory leaks.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">c</td><td>: the context from which the handle will be created (NULL for default context) </td></tr>
    <tr><td class="paramname">f</td><td>: the file resource </td></tr>
    <tr><td class="paramname">error</td><td>: error code set if the returned handle is NULL and the end of file is not reached </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>the new handle, NULL if the resource is invalid or a problem is encountered </dd></dl>

</div>
</div>
<a class="anchor" id="ga56d0f831e520ec7bc4a0ca334c63f557"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structcodes__handle.html">codes_handle</a>* codes_bufr_handle_new_from_samples </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structcodes__context.html">codes_context</a> *&#160;</td>
          <td class="paramname"><em>c</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>sample_name</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Create a handle from a BUFR message contained in a samples directory. </p>
<p>The message is copied at the creation of the handle</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">c</td><td>: the context from which the handle will be created (NULL for default context) </td></tr>
    <tr><td class="paramname">sample_name</td><td>: the name of the sample file (without the .tmpl extension) </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>the new handle, NULL if the resource is invalid or a problem is encountered </dd></dl>

</div>
</div>
<a class="anchor" id="ga4c2203d55c2c3ca792e44e4eb26edfb5"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int codes_count_in_file </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structcodes__context.html">codes_context</a> *&#160;</td>
          <td class="paramname"><em>c</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">FILE *&#160;</td>
          <td class="paramname"><em>f</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int *&#160;</td>
          <td class="paramname"><em>n</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Counts the messages contained in a file resource. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">c</td><td>: the context from which the handle will be created (NULL for default context) </td></tr>
    <tr><td class="paramname">f</td><td>: the file resource </td></tr>
    <tr><td class="paramname">n</td><td>: the number of messages in the file </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>0 if OK, integer value on error </dd></dl>

</div>
</div>
<a class="anchor" id="ga36de77229cc3b386d26c1e7b52c21e0e"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">grib_handle* codes_grib_handle_new_from_file </td>
          <td>(</td>
          <td class="paramtype">grib_context *&#160;</td>
          <td class="paramname"><em>c</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">FILE *&#160;</td>
          <td class="paramname"><em>f</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int *&#160;</td>
          <td class="paramname"><em>error</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Create a GRIB handle from a file resource. </p>
<p>The file is read until a GRIB message is found. The message is then copied. Remember always to delete the handle when it is not needed anymore to avoid memory leaks.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">c</td><td>: the context from which the handle will be created (NULL for default context) </td></tr>
    <tr><td class="paramname">f</td><td>: the file resource </td></tr>
    <tr><td class="paramname">error</td><td>: error code set if the returned handle is NULL and the end of file is not reached </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>the new handle, NULL if the resource is invalid or a problem is encountered </dd></dl>

</div>
</div>
<a class="anchor" id="ga385864d5f06e1de0e8ee13388ca4117c"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structcodes__handle.html">codes_handle</a>* codes_grib_handle_new_from_multi_message </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structcodes__context.html">codes_context</a> *&#160;</td>
          <td class="paramname"><em>c</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">void **&#160;</td>
          <td class="paramname"><em>data</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t *&#160;</td>
          <td class="paramname"><em>data_len</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int *&#160;</td>
          <td class="paramname"><em>error</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Create a handle from a user message in memory. </p>
<p>The message will not be freed at the end. The message will be copied as soon as a modification is needed. This function works also with multi field messages.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">c</td><td>: the context from which the handle will be created (NULL for default context) </td></tr>
    <tr><td class="paramname">data</td><td>: the actual message </td></tr>
    <tr><td class="paramname">data_len</td><td>: the length of the message in number of bytes </td></tr>
    <tr><td class="paramname">error</td><td>: error code </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>the new handle, NULL if the message is invalid or a problem is encountered </dd></dl>

</div>
</div>
<a class="anchor" id="ga3b281a237e311c6b8fa4bd7096d7e025"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structcodes__handle.html">codes_handle</a>* codes_grib_handle_new_from_samples </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structcodes__context.html">codes_context</a> *&#160;</td>
          <td class="paramname"><em>c</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>sample_name</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Create a handle from a GRIB message contained in a samples directory. </p>
<p>The message is copied at the creation of the handle</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">c</td><td>: the context from which the handle will be created (NULL for default context) </td></tr>
    <tr><td class="paramname">sample_name</td><td>: the name of the sample file (without the .tmpl extension) </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>the new handle, NULL if the resource is invalid or a problem is encountered </dd></dl>

</div>
</div>
<a class="anchor" id="ga068715aab8b82a5d3092064b6bc27f3d"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int codes_grib_multi_handle_append </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structcodes__handle.html">codes_handle</a> *&#160;</td>
          <td class="paramname"><em>h</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>start_section</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structcodes__multi__handle.html">codes_multi_handle</a> *&#160;</td>
          <td class="paramname"><em>mh</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Append the sections starting with start_section of the message pointed by h at the end of the multi-field GRIB handle mh. </p>
<p>Remember always to delete the multi-handle when it is not needed any more to avoid memory leaks.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">h</td><td>: The handle from which the sections are copied. </td></tr>
    <tr><td class="paramname">start_section</td><td>: section number. Starting from this section all the sections to the end of the message will be copied. </td></tr>
    <tr><td class="paramname">mh</td><td>: The multi-field handle on which the sections are appended. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>0 if OK, integer value on error </dd></dl>

</div>
</div>
<a class="anchor" id="ga85a955bdd3012ce499e50768e298b849"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int codes_grib_multi_handle_delete </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structcodes__multi__handle.html">codes_multi_handle</a> *&#160;</td>
          <td class="paramname"><em>mh</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Delete multi-field GRIB handle. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">mh</td><td>: The multi-field handle to be deleted. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>0 if OK, integer value on error </dd></dl>

</div>
</div>
<a class="anchor" id="ga5ff59672d9eab49c0285c8f60e379d88"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structcodes__multi__handle.html">codes_multi_handle</a>* codes_grib_multi_handle_new </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structcodes__context.html">codes_context</a> *&#160;</td>
          <td class="paramname"><em>c</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Create an empty multi-field GRIB handle. </p>
<p>Remember always to delete the multi-handle when it is not needed any more to avoid memory leaks.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">c</td><td>: the context from which the handle will be created (NULL for default context) </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="gac06089d897eea71d8944cc622a45737f"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int codes_grib_multi_handle_write </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structcodes__multi__handle.html">codes_multi_handle</a> *&#160;</td>
          <td class="paramname"><em>mh</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">FILE *&#160;</td>
          <td class="paramname"><em>f</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Write a multi-field GRIB handle in a file. </p>
<p>Remember always to delete the multi-handle when it is not needed any more to avoid memory leaks.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">mh</td><td>: The multi-field GRIB handle to be written. </td></tr>
    <tr><td class="paramname">f</td><td>: File on which the file handle is written. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>0 if OK, integer value on error </dd></dl>

</div>
</div>
<a class="anchor" id="ga7b226527aa98d90f2bdb470105732878"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structcodes__handle.html">codes_handle</a>* codes_handle_clone </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structcodes__handle.html">codes_handle</a> *&#160;</td>
          <td class="paramname"><em>h</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Clone an existing handle using the context of the original handle, The message is copied and reparsed. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">h</td><td>: The handle to be cloned </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>the new handle, NULL if the message is invalid or a problem is encountered </dd></dl>

</div>
</div>
<a class="anchor" id="ga358ea000ceed775e7367ccab581be978"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int codes_handle_delete </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structcodes__handle.html">codes_handle</a> *&#160;</td>
          <td class="paramname"><em>h</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Frees a handle, also frees the message if it is not a user message. </p>
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="group__codes__handle.html#ga095447ed85ff2142dbda2867ee3b4c8d" title="Create a handle from a user message in memory. ">codes_handle_new_from_message</a> </dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">h</td><td>: The handle to be deleted </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>0 if OK, integer value on error </dd></dl>

</div>
</div>
<a class="anchor" id="ga6ec42bd6272b4a0f2cb2b220b86c71c8"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">grib_handle* codes_handle_new_from_file </td>
          <td>(</td>
          <td class="paramtype">grib_context *&#160;</td>
          <td class="paramname"><em>c</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">FILE *&#160;</td>
          <td class="paramname"><em>f</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">ProductKind&#160;</td>
          <td class="paramname"><em>product</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int *&#160;</td>
          <td class="paramname"><em>error</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Create a handle from a file resource. </p>
<p>The file is read until a message is found. The message is then copied. Remember always to delete the handle when it is not needed anymore to avoid memory leaks.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">c</td><td>: the context from which the handle will be created (NULL for default context) </td></tr>
    <tr><td class="paramname">f</td><td>: the file resource </td></tr>
    <tr><td class="paramname">product</td><td>: the kind of product e.g. PRODUCT_GRIB, PRODUCT_BUFR </td></tr>
    <tr><td class="paramname">error</td><td>: error code set if the returned handle is NULL and the end of file is not reached </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>the new handle, NULL if the resource is invalid or a problem is encountered </dd></dl>

</div>
</div>
<a class="anchor" id="ga095447ed85ff2142dbda2867ee3b4c8d"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structcodes__handle.html">codes_handle</a>* codes_handle_new_from_message </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structcodes__context.html">codes_context</a> *&#160;</td>
          <td class="paramname"><em>c</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const void *&#160;</td>
          <td class="paramname"><em>data</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>data_len</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Create a handle from a user message in memory. </p>
<p>The message will not be freed at the end. The message will be copied as soon as a modification is needed.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">c</td><td>: the context from which the handle will be created (NULL for default context) </td></tr>
    <tr><td class="paramname">data</td><td>: the actual message </td></tr>
    <tr><td class="paramname">data_len</td><td>: the length of the message in number of bytes </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>the new handle, NULL if the message is invalid or a problem is encountered </dd></dl>

</div>
</div>
<a class="anchor" id="ga079df0c709e381812ae13af08c354032"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structcodes__handle.html">codes_handle</a>* codes_handle_new_from_message_copy </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structcodes__context.html">codes_context</a> *&#160;</td>
          <td class="paramname"><em>c</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const void *&#160;</td>
          <td class="paramname"><em>data</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>data_len</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Create a handle from a user message. </p>
<p>The message is copied and will be freed with the handle</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">c</td><td>: the context from which the handle will be created (NULL for default context) </td></tr>
    <tr><td class="paramname">data</td><td>: the actual message </td></tr>
    <tr><td class="paramname">data_len</td><td>: the length of the message in number of bytes </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>the new handle, NULL if the message is invalid or a problem is encountered </dd></dl>

</div>
</div>
<a class="anchor" id="gac82dbaba240ebf6e76cdbcf2007a6bee"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int codes_write_message </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structcodes__handle.html">codes_handle</a> *&#160;</td>
          <td class="paramname"><em>h</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>file</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>mode</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Write a coded message to a file. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">h</td><td>: <a class="el" href="structcodes__handle.html">codes_handle</a> to be written </td></tr>
    <tr><td class="paramname">file</td><td>: name of the output file </td></tr>
    <tr><td class="paramname">mode</td><td>: mode </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>0 if OK, integer value on error </dd></dl>

</div>
</div>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.5
</small></address>
</body>
</html>
